#include <buola/image/format.h>
#include <buola/image/io.h>
#include <buola/image/drawing/basic.h>
#include <buola/image/adaptors.h>
#include <buola/image/views/cmaskedview.h>
#include <buola/image/rasterizer/cscanlinerasterizer.h>
#include <buola/image/rasterizer/cscanline.h>
#include <buola/image/cpath.h>
#include <buola/image/cimagegc.h>
#include <buola/image/vertex/cbspline.h>

using namespace buola;

int main()
{
    img::CImage_rgb8 lImage({320,200},img::CColor(L"DarkGray"));

    img::CImageGC<img::TFormat_rgb8> lGC(lImage);

    lGC.SetLineWidth(3.5);
//    lGC.SetLineCap(img::ELineCap::SQUARE);
    lGC.SetLineJoin(img::ELineJoin::MITER);

    start_timer();
//    for(int i=0;i<50000;i++)
    {
        lGC.Path().MoveTo({40,40});
        lGC.Path().LineTo({140,40});
        lGC.Path().LineTo({140,140});
        lGC.Path().LineTo({40,140});
        lGC.Path().Close();
        lGC.Path().MoveTo({7,7});
        lGC.Path().CurveTo({173,7},{90,90},{173,173});
        lGC.Path().CurveTo({7,173},{90,90},{7,7});
        
        lGC.SetSource(img::CColor(L"HotPink"));
        lGC.FillPath(true);
        lGC.SetSource(img::CColor(L"DeepPink",0.5));
        lGC.StrokePath();
    }
    end_timer();

    img::save(lImage,io::file("agg7.ppm"));
}
